Description
The Add
method is used to append an item to the end of the NetList<T>
. This method is sealed, meaning it cannot be overridden in derived classes. It is a virtual method, allowing for potential extension in the base class. The method is public and non-static, meaning it can be accessed by any instance of NetList<T>
.
Usage
To use the Add
method, simply call it on an instance of NetList<T>
with the item you wish to add as the parameter. Ensure that the item type matches the generic type T
of the NetList
.
Example
public class MyComponent : Component
{
[Sync] public NetList<int> MyIntegerList { get; set; } = new();
public void AddNumber(int number)
{
if (IsProxy) return;
MyIntegerList.Add(number);
}
}